function getDeviceType(){
	var u = navigator.userAgent;
	if (/(iPhone|iPad|iPod|iOS)/i.test(u)) { 
	    return 'ios';
	} else if (/(Android)/i.test(u)) {  
	    return 'android';
	} else { 
		return 'pc';
	}
}
function getBrowserType(){
	var u = navigator.userAgent; 
	if( u.indexOf('MicroMessenger') > -1 ){
		return 'weixin';
	}else if(u.match(/\sQQ/i) == "qq"){
		return 'qq';
	}else{
		return 'browser';
	}
}
function generateUID(length) {
    var id = '',
        length = length || 32;
    while (length--)
        id += (Math.random() * 16 | 0) % 2 ? (Math.random() * 16 | 0).toString(16) : (Math.random() * 16 | 0).toString(16).toUpperCase();
    return id.toLowerCase();
}
function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return (r[2]);
    return null;
}

function setCookie(name,value,time){ 
	var exp = new Date(); 
	exp.setTime(exp.getTime() + time*1000); 
	document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString(); 
}
		
function getCookie(name){ 
	var arr,reg = new RegExp("(^| )"+name+"=([^;]*)(;|$)");
	if(arr=document.cookie.match(reg))
		return unescape(arr[2]); 
	else 
		return null; 
}

function isLandscape() {
	if (window.orientation == 90 || window.orientation == -90) {
		return true;
	}
	else if (window.orientation == 0 || window.orientation == 180) {
		return false;
	}
}